improvement(preview): consolidate block rendering and fix handle configurations#3013
Merged
waleedlatif1 merged 2 commits intostagingfrom Jan 26, 2026
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
Greptile OverviewGreptile SummaryConsolidated subflow and block rendering into a single component (
The changes maintain visual parity with existing workflow blocks while improving rendering performance and correctness. Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant TemplateCard
participant WorkflowPreview
participant WorkflowPreviewBlock
participant SubflowContainer
participant BlockConfig
TemplateCard->>WorkflowPreview: render(workflowState, lightweight=true)
WorkflowPreview->>WorkflowPreview: Build containerChildIndex (O(n) parent-child mapping)
WorkflowPreview->>WorkflowPreview: Calculate nodes from workflowState.blocks
loop For each block
alt Block is loop/parallel
WorkflowPreview->>WorkflowPreview: Get childBlocks from containerChildIndex (O(1))
WorkflowPreview->>WorkflowPreview: calculateContainerDimensions(childBlocks)
WorkflowPreview->>WorkflowPreviewBlock: render(isSubflow=true, subflowKind, width, height)
WorkflowPreviewBlock->>SubflowContainer: render(name, width, height, kind)
SubflowContainer-->>WorkflowPreviewBlock: Container with handles (target, start-source, end-source)
else Block is regular
WorkflowPreview->>WorkflowPreviewBlock: render(type, name, isTrigger, subBlockValues, lightweight)
WorkflowPreviewBlock->>BlockConfig: getBlock(type)
alt lightweight=false
WorkflowPreviewBlock->>WorkflowPreviewBlock: buildCanonicalIndex(subBlocks)
WorkflowPreviewBlock->>WorkflowPreviewBlock: Calculate visibleSubBlocks with trigger mode logic
alt effectiveTrigger=true AND isPureTriggerBlock=true
WorkflowPreviewBlock->>WorkflowPreviewBlock: Show subblocks with mode=trigger OR no mode
else effectiveTrigger=true AND isPureTriggerBlock=false
WorkflowPreviewBlock->>WorkflowPreviewBlock: Show only subblocks with mode=trigger
else effectiveTrigger=false
WorkflowPreviewBlock->>WorkflowPreviewBlock: Hide all subblocks with mode=trigger
end
alt Block is condition
WorkflowPreviewBlock->>WorkflowPreviewBlock: Calculate condition rows from rawValues
WorkflowPreviewBlock->>WorkflowPreviewBlock: Render handles for each condition branch + error handle
else Block is router_v2
WorkflowPreviewBlock->>WorkflowPreviewBlock: Calculate router rows from rawValues
WorkflowPreviewBlock->>WorkflowPreviewBlock: Render handles for each route + error handle
else Block is standard
WorkflowPreviewBlock->>WorkflowPreviewBlock: Render source handle + error handle (if not trigger)
end
else lightweight=true
WorkflowPreviewBlock->>WorkflowPreviewBlock: Skip expensive computations (empty canonicalIndex, rawValues, visibleSubBlocks)
end
end
end
WorkflowPreview->>WorkflowPreview: Calculate edges with execution status
WorkflowPreview-->>TemplateCard: ReactFlow with consolidated rendering
|
apps/sim/app/workspace/[workspaceId]/w/components/preview/components/block.tsx
Outdated
Show resolved
Hide resolved
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Type of Change
Testing
Tested manually
Checklist